﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Xml.Linq;
using System.IO;
using System.Data.SQLite;

namespace green
{
    public class Global : System.Web.HttpApplication
    {
        private static SQLiteConnection _con = null;
        public static SQLiteConnection getConnection()
        {
            return _con.Clone() as SQLiteConnection;
        }
        protected void Application_Start(object sender, EventArgs e)
        {
            ////string path = Server.MapPath("/");
            //string path = Path.Combine(Server.MapPath("/"), "green.sqlite");
            //_con = new SQLiteConnection("Data Source=" + path);
            string conStr = ConfigurationManager.ConnectionStrings["sqliteCon"].ConnectionString;
            _con = new SQLiteConnection(conStr);
        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {
            _con = null;
        }
    }
}